<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>

<%@page import="com.wzw.tcjh.PageDivision"%>
<%@page import="java.util.List"%>
<%@page import="com.wzw.tcjh.Customer"%>
<%@page import="com.wzw.tcjh.CustomerTools"%>
<%@page import="com.wzw.util.ProjectCode"%><html xmlns="http://www.w3.org/1999/xhtml">
<% int pageSize = 10; %>
<head>
<title>汇丰晋信天才儿童的添财计划—天才基因早发现</title>
<link href="css/main.css" media="screen" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {color: #eb1a11}
-->
</style>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function submitForm(){
  document.loginForm.submit();
}

//-->
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<% 
	if(session.getAttribute("user")==null || session.getAttribute("projectCode")==null){
		response.sendRedirect("login.jsp");
		return;
	}

	//page division part(top)
	int currentPage = 1;
	String currentPageString = request.getParameter("currentPage");
	String pcode = (String)session.getAttribute("projectCode");
	if(currentPageString!=null&&!"".equals(currentPageString))
		currentPage = Integer.parseInt(currentPageString);
	StringBuffer searchSQL = new StringBuffer();
	searchSQL.append("and projectcode = '" + pcode + "'");
	/*
	if(request.getParameter("birthday")!=null&&!request.getParameter("birthday").trim().equals("")){
		if(searchSQL.length() > 0)
			searchSQL.append(" or Substring(CONVERT(varchar(100),birthday, 23),6,5) = '" + request.getParameter("birthday").trim().substring(5) + "'");
		else
			searchSQL.append("and (Substring(CONVERT(varchar(100),birthday, 23),6,5) = '" + request.getParameter("birthday").trim().substring(5) + "'");
	}
	if(searchSQL.length() > 0)		
		searchSQL.append(")");
	*/
		
	String countSql = "select id from customer where Available = 1 and projectcode='" + (String)session.getAttribute("projectCode") + "'" + (searchSQL.length()>0?searchSQL.toString():"");
	PageDivision pd = new PageDivision(currentPage, pageSize, countSql);
	List<Customer> customerList =  CustomerTools.getCustomerList((searchSQL.length()>0?searchSQL.toString():"") + " order by cdate desc", pd);
	%>
	<body>
	<jsp:include page="/adminNav.jsp" />
	<div class="head">
	  <script type="text/javascript">
	    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','950','height','222','src','images/top','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','images/top' ); //end AC code
	  </script>
	  <noscript>
	    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="222">
	      <param name="movie" value="images/top.swf" />
	      <param name="quality" value="high" />
	      <param name="wmode" value="transparent" />
	      <embed src="images/top.swf" width="950" height="222" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
	    </object>
	  </noscript>
	</div>
	<form name="loginForm" method="post" action="vaward.jsp" target="loginIframe">

	<center>
	<br/>
		            <h3><font color="black">参与者列表</font></h3> 
	              	<table border="1" cellpadding="0" cellspacing="0" width="80%">
	              		<tr>
	              			<th>日期</th>
	              			<th>姓名</th>
	              			<th>手机</th>
	              			<th>邮箱</th>
							<%if(ProjectCode.TCXB.getValue().equals(pcode)){%>
							<th>地址</th>
							<%}%>
	              			<th>中奖状态</th>
	              			<th>选择中奖</th>
	              		</tr>
<%
				for(Customer customer : customerList){		
%>                  
                    <tr>
                    	<td align="center"><span><%=customer.getDate()%></span></td>
                    	<td align="center"><span><%=customer.getName()%></span></td>
                    	<td align="center"><span><%=customer.getPhone()%></span></td>
                    	<td align="center"><span><%=customer.getEmail()%></span></td>
                    	<%if(ProjectCode.TCXB.getValue().equals(pcode)){%>
						<td align="center"><span><%=customer.getAddress()%></span></td>
						<%}%>
                    	<td align="center"><span id="award_<%=customer.getId()%>"><%=customer.isAward()?"中奖":"未中奖"%></span></td>
                    	<td align="center"><span><input type="checkbox" name="award" value="<%=customer.getId()%>" <%=customer.isAward()?"checked disabled":""%>/></span></td>
                    </tr>
<%
				}
%>
					<tr><td colspan="<%=ProjectCode.TCXB.getValue().equals(pcode)?"7":"6"%>" align="right"><input type="button" value="提交中奖名单" onclick="submitForm()" style="cursor:hand"></input></td></tr>
              </table>
<%
	//page division part(bottom)
	if(pd!=null&&pd.getTotalPage()>1){
%>
		<div>
			<br/><span><% pd.showPageList(out, "statistics.jsp?currentPage=");%></span>		
		</div>
<% 
	}
%>
</center>                  
</form>
</body>
</html>
<iframe name="loginIframe" frameborder="0" width="500" height="300" style="display:none"></iframe>